package com.xiaotao.service.impl;

import com.xiaotao.entity.Good;
import com.xiaotao.mapper.GoodMapper;
import com.xiaotao.service.GoodService;
import com.xiaotao.util.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodServiceImpl implements GoodService {
    @Resource
    private GoodMapper goodMapper;

    @Override
    public Result findOnLine() {
        List<Good> list = goodMapper.findALL();
        return list != null ? Result.get(200, "查询成功", list) :
                Result.get(500, "查询失败");
    }

    @Override
    public Result findById(Integer id) {
        Good good = goodMapper.findById(id);
        return good != null ? Result.get(200, "查询成功", good) :
                Result.get(500, "查询失败");
    }

    @Override
    public Result updateBuyNum(Good good) {
        Integer i = goodMapper.updateBuyNum(good);
        return null;
    }
}
